/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1631843281769_7586';

  // add your middleware config here
  config.middleware = ['errorHandler'];

  // add your user config here
  const userConfig = {
    mysql: {
      client: {
        host: 'localhost',
        port: '3306',
        user: 'briup',
        password: 'briupSH',
        database: 'briup-sc',
      },
      // 是否加载到 app 上，默认开启
      app: true,
      // 是否加载到 agent 上，默认关闭
      agent: false,
    },
    security: {
      csrf: {
        enable: false,
      },
    },
    cors: {
      origin: '*',
      allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
    },
    jwt: {
      secret: '888888'
    },
    swaggerdoc: {
      dirScanner: "./app/controller",
      apiInfo: {
        title: "Briup-学生选课系统",
        description: "学生选课系统接口文档",
        version: "1.0.0",
      },
      schemes: ["http", "https"],
      consumes: ["application/json"],
      produces: ["application/json"],
      enableSecurity: false,
      // enableValidate: true,
      routerMap: false,
      enable: true,
    }
  };

  return {
    ...config,
    ...userConfig,
  };
};
